To use the JavaFX based dialog spell checker as an integral part of your application simply instantiate it's controller, and call it's check(List<InputTextControl>) method.
Example, the following code is the controller class for a simple Stage class and it's FXML.
package rapidspelldesktopfx.test;
import com.keyoti.rapidSpell.desktop.fx.RapidSpellDialogController;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextInputControl;
import javafx.scene.input.MouseEvent;
/**
* FXML Controller class
*
*/
public class MainStageController implements Initializable {
@FXML
TextArea textArea;
@FXML
TextArea textArea2;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
public void handleButtonAction(MouseEvent event) {
List<TextInputControl> textAreas = new ArrayList<TextInputControl>();
textAreas.add(textArea);
textAreas.add(textArea2);
try {
RapidSpellDialogController rsd = RapidSpellDialogController.create();
rsd.check(textAreas);
} catch (IOException e) {
e.printStackTrace();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="rapidspelldesktopfx.test.MainStageController">
<children>
<Button layoutX="516.0" layoutY="352.0" mnemonicParsing="false" onMouseClicked="#handleButtonAction" text="Spell check" />
<TextArea fx:id="textArea" layoutX="32.0" layoutY="14.0" prefHeight="200.0" prefWidth="539.0" text="Helloo world" wrapText="true" />
<TextArea id="textArea" fx:id="textArea2" layoutX="32.0" layoutY="223.0" prefHeight="116.0" prefWidth="539.0000999999975" text="here's another textboxx with some more errorss" wrapText="true" />
</children>
</AnchorPane>